import request from '@/utils/request'

// 查询考勤记录列表
export function listAttendanceRecord(query) {
  return request({
    url: '/attendance/attendanceRecord/list',
    method: 'get',
    params: query
  })
}

// 查询考勤记录统计
export function analysisAttendanceRecord(query) {
  return request({
    url: '/attendance/attendanceRecord/analysis',
    method: 'get',
    params: query
  })
}

// 学生查询所有选课老师发布的考勤列表
export function listAttendanceRecordForStudent(query) {
  return request({
    url: '/attendance/attendanceRecord/student/list',
    method: 'get',
    params: query
  })
}

// 查询签到状态
export function getSignStatus(courseRecordId) {
  return request({
    url: '/attendance/attendanceRecord/student/' + courseRecordId,
    method: 'get'
  })
}

// 查询考勤记录结束状态
export function getEndType(courseId) {
  return request({
    url: '/attendance/attendanceRecord/endType/' + courseId,
    method: 'get'
  })
}

// 查询考勤记录详细
export function getAttendanceRecord(attendanceId) {
  return request({
    url: '/attendance/attendanceRecord/' + attendanceId,
    method: 'get'
  })
}

// 新增考勤记录
export function addAttendanceRecord(data) {
  return request({
    url: '/attendance/attendanceRecord',
    method: 'post',
    data: data
  })
}

// 修改考勤记录
export function updateAttendanceRecord(data) {
  return request({
    url: '/attendance/attendanceRecord',
    method: 'put',
    data: data
  })
}

// 删除考勤记录
export function delAttendanceRecord(attendanceId) {
  return request({
    url: '/attendance/attendanceRecord/' + attendanceId,
    method: 'delete'
  })
}
